package com.zh.note.huawei.onehundred.GPU调度;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @Author: zhanghuan
 * @date: 2023/9/2 18:26
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // int n = sc.nextInt();
        // int len = sc.nextInt();
        // String line = sc.nextLine();
        int n = 4;
        String line = "5 4 1 1 1";

        String[] s1 = line.split(" ");
        Integer[] nums = Arrays.stream(s1).map(s -> Integer.valueOf(s)).toArray(Integer[]::new);
        Arrays.sort(nums, Comparator.reverseOrder());
        int time = 0;
        int more = 0;//表示上一次的剩余任务
        for (int num : nums) {
            int less = num + more;
            if (less > n) {
                more = num + more - n;
            } else {
                more = 0;
            }
            time++;
        }
        while (more > 0) {
            more -= n;
            time++;
        }
        System.out.println(time);

    }
}
